//
//  UIBarButtonItem+Extension.swift
//  Webo
//
//  Created by 曾静 on 16/6/25.
//  Copyright © 2016年 qq. All rights reserved.
//

import UIKit


//创建好的UIBarButtonItem,用于快速创建UIBarButtonItem
extension UIBarButtonItem {


    convenience init(title:String,font:CGFloat,target:AnyObject?,selector:Selector) {
        
        //在便利构造函数里面调用指定的构造函数
        self.init()
        
        let btn = UIButton()
        
        btn .setTitle(title, forState: UIControlState.Normal)
        
        btn .addTarget(self, action: selector, forControlEvents: UIControlEvents.TouchUpInside)
        
        btn .setTitleColor(ThemeColor, forState: UIControlState.Highlighted)
        
        btn.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        
        btn.titleLabel?.font = UIFont.systemFontOfSize(font)
        
        btn .sizeToFit()

        customView = btn

    }
    
    
}